gnomeos: sysvinit actually runs inside the chroot
authorColin Walters <walters@verbum.org>
Tue, 15 Nov 2011 20:19:31 +0000 (15:19 -0500)
committerColin Walters <walters@verbum.org>
Tue, 15 Nov 2011 20:19:31 +0000 (15:19 -0500)
gnomeos/yocto/commit-yocto-build.sh
gnomeos/yocto/gnomeos-run.sh
gnomeos/yocto/recipies-core/images/gnomeos-image-contents.bb
gnomeos/yocto/recipies-core/ostree-init/ostree-init.c

index d9ee3a5f28242bede239b88b51551e13b4369aad..78d2343b18b5506ff7436ee1440c2c38dddae964 100755 (executable)
@@ -23,10 +23,12 @@ BUILD_TAR=$1
 test -n "$BUILD_TAR" || usage
 shift
 
+origcwd=`pwd`
 tempdir=`mktemp -d tmp-commit-yocto-build.XXXXXXXXXX`
 cd $tempdir
 mkdir fs
 cd fs
 fakeroot -s ../fakeroot.db tar xf $BUILD_TAR
 fakeroot -i ../fakeroot.db ostree --repo=${OSTREE_REPO} commit -s "Build (need ostree git version here)" -b gnomeos-base
+cd ${origcwd}
 rm -rf $tempdir
index b9b750e9b05ab005986b936ac5380ec05a04908b..5fbc01ca1c5fc7b982ba87cb45fef4fe6ace65d8 100755 (executable)
@@ -74,15 +74,19 @@ if (! test -f ${OBJ}); then
     cd ${WORKDIR}
     
     umount fs
+    rmdir fs
     mv ${OBJ}.tmp ${OBJ}
 fi
 
 ARGS="$@"
-if ! [ echo $ARGS | grep -q 'init=']; then
+if ! echo $ARGS | grep -q 'init='; then
     ARGS="init=/ostree-init $ARGS"
 fi
-if ! [ echo $ARGS | grep -q 'root=']; then
+if ! echo $ARGS | grep -q 'root='; then
     ARGS="root=/dev/hda $ARGS"
 fi
+if ! echo $ARGS | grep -q 'ostree='; then
+    ARGS="ostree=current $ARGS"
+fi
 
 exec qemu-kvm -kernel ./tmp/deploy/images/bzImage-qemux86.bin -hda gnomeos-fs.img -append "$ARGS"
index fefda5ad138c341708142c69399107c1d2cf73c9..7e2e273bd287758cae004b11fe0393fe16753d49 100644 (file)
@@ -10,7 +10,7 @@ inherit rootfs_${IMAGE_PKGTYPE}
 PACKAGE_INSTALL = "task-core-boot task-base-extended \
                   ostree ostree-init"
 RDEPENDS += "${PACKAGE_INSTALL}"
-DEPENDS += "virtual/fakeroot-native"
+DEPENDS += "makedevs-native virtual/fakeroot-native"
 
 EXCLUDE_FROM_WORLD = "1"
 
@@ -20,6 +20,9 @@ do_rootfs[lockfiles] += "${IMAGE_ROOTFS}.lock"
 do_build[nostamp] = "1"
 do_rootfs[umask] = 022
 
+def gnomeos_get_devtable_list(d):
+    return bb.which(d.getVar('BBPATH', 1), 'files/device_table-minimal.txt')
+
 # Must call real_do_rootfs() from inside here, rather than as a separate
 # task, so that we have a single fakeroot context for the whole process.
 fakeroot do_rootfs () {
@@ -31,6 +34,8 @@ fakeroot do_rootfs () {
 
        rootfs_${IMAGE_PKGTYPE}_do_rootfs
 
+       makedevs -r ${IMAGE_ROOTFS} -D ${@gnomeos_get_devtable_list(d)}
+
        echo "GNOME OS Unix login" > ${IMAGE_ROOTFS}/etc/issue
 
        TOPROOT_BIND_MOUNTS="home root tmp"
@@ -48,6 +53,8 @@ fakeroot do_rootfs () {
        for d in $READONLY_BIND_MOUNTS; do
             mv ${IMAGE_ROOTFS}/$d .
        done
+       # Also copy over any static /dev contents for now
+       mv ${IMAGE_ROOTFS}/dev .
        rm -rf ${IMAGE_ROOTFS}
        mv ${WORKDIR}/gnomeos-contents ${IMAGE_ROOTFS}
 
index d0368dcf04776a91e71429399d7b1322e6fc927e..2c214e81b9687a3225b5d6ca234bf75f8f9e4abd 100644 (file)
@@ -112,6 +112,8 @@ int main(int argc, char *argv[])
       exit (1);
     }
 
+  fprintf (stderr, "ostree-init kernel cmdline: %s\n", buf);
+  fflush (stderr);
   p = buf;
   while (p != NULL)
     {
@@ -142,7 +144,7 @@ int main(int argc, char *argv[])
       snprintf (destpath, sizeof(destpath), "/ostree/%s/var", ostree_root);
       if (mount ("/ostree/var", destpath, NULL, MS_BIND, NULL) < 0)
        {
-         perrorv ("Failed to bind mount /ostree/var to '%s'", destpath);
+         perrorv ("Failed to bind mount / to '%s'", destpath);
          exit (1);
        }
 
@@ -181,7 +183,7 @@ int main(int argc, char *argv[])
     init_argv[i] = argv[i];
   init_argv[i] = NULL;
   
-  fprintf (stderr, "ostree-init: Running real init\n");
+  fprintf (stderr, "ostree-init: Running real init (argc=%d)\n", argc);
   fflush (stderr);
   execv (INIT_PATH, init_argv);
   perrorv ("Failed to exec init '%s'", INIT_PATH);